/**
/ * @author Goh Zhe Yi (A0050823)
 */
package sg.edu.nus.iss.team4ft.service;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import sg.edu.nus.iss.team4ft.util.AppConstant;
import sg.edu.nus.iss.team4ft.util.DateUtil;
import sg.edu.nus.iss.team4ft.util.NumberUtil;


public class Bill implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String coName;
	private String coNameShort;
	private Address coAdd;
	private Account account;
	private Customer customer;
	private Date billDate;
	private Date dueDate;
	private Date payDate;
	private Double prevBalance;
	private Double paymts;
	private Double currCharges;
	private Double totalCharge;
	private Double totalCurrAndGST;
	private List<Plan> plans;
	private List<Feature> features;
	
	public Bill() {
		this.billDate = DateUtil.getDate();
		this.prevBalance=0.0;
		this.paymts=0.0;
		this.currCharges=0.0;
		this.totalCharge=0.0;
		this.totalCurrAndGST=0.0;
	}

	public String getCoName() {
		return coName;
	}

	public void setCoName(String coName) {
		this.coName = coName;
	}

	public String getCoNameShort() {
		return coNameShort;
	}

	public void setCoNameShort(String coNameShort) {
		this.coNameShort = coNameShort;
	}

	public Address getCoAdd() {
		return coAdd;
	}

	public void setCoAdd(Address coAdd) {
		this.coAdd = coAdd;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public Date getBillDate() {
		return billDate;
	}
	
	public void setBillDate(Date billDate) {
		this.billDate = billDate;
	}
	
	public String getBillDateStr(){
		return DateUtil.format(this.billDate, DateUtil.DATE_FORMAT);
	}
	
	public Date getDueDate() {
		dueDate = DateUtil.add(billDate, Calendar.DAY_OF_MONTH, AppConstant.CREDIT_TERMS);		
		return dueDate;
	}
	
	public String getDueDateStr() {
		return DateUtil.format(this.getDueDate(), DateUtil.DATE_FORMAT);
	}
	
	public Double getPrevBalance() {
		return prevBalance;
	}
	
	public String getPrevBalanceStr(){
		return NumberUtil.format(prevBalance, 2);
	}
	
	public void setPrevBalance(Double prevBalance) {
		this.prevBalance = prevBalance;
	}

	public Double getPaymts() {
		return paymts;
	}
	
	public String getPaymtsStr(){
		return NumberUtil.format(paymts, 2);
	}

	public void setPaymts(Double paymts) {
		this.paymts = paymts;
	}

	public Double getCurrCharges() {
		return currCharges;
	}
	
	public String getCurrChargesStr(){
		return NumberUtil.format(currCharges, 2);
	}

	public void setCurrCharges(Double currCharges) {
		this.currCharges = currCharges;
	}

	public Double getTotalCharge() {
		return totalCharge;
	}
	
	public String getTotalChargeStr(){
		return NumberUtil.format(totalCharge,2);
	}

	public void setTotalCharge(Double totalCharge) {
		this.totalCharge = totalCharge;
	}

	public Date getPayDate() {
		return payDate;
	}

	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}
	
	public String getPayDateStr(){
		return DateUtil.format(this.payDate, DateUtil.DATE_FORMAT);
	}

	public String getTotalCurrAndGSTStr() {
		this.totalCurrAndGST = this.currCharges * (1+AppConstant.GST);		
		return NumberUtil.format(totalCurrAndGST, 2);
	}
	
	public Double getTotalCurrAndGST(){
		return this.currCharges * (1+AppConstant.GST);	
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public List<Plan> getPlans() {
		return plans;
	}

	public void setPlans(List<Plan> plans) {
		this.plans = plans;
	}

	public List<Feature> getFeatures() {
		return features;
	}

	public void setFeatures(List<Feature> features) {
		this.features = features;
	}
	
}
